<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="../../favicon.ico" rel="icon">
<title>文件类型配置</title>

<link rel="stylesheet" href="${request.contextPath}/core/css/bootstrap.min.css">
<link rel="stylesheet" href="${request.contextPath}/core/css/font-awesome.min.css">
<link rel="stylesheet" href="${request.contextPath}/css/suredy-ui.css">
</head>
<body>
	<div class="container" style="margin-top: 5px;">
		<div class="navbar navbar-default">
			<div class="navbar-header">
				<a class="navbar-brand" href="#" style="border-right: 1px solid #ddd;">
					<i class="icon-flag"></i>
					<#if data.id??>修改<#else>新建</#if>文件配置
				</a>
			</div>
			<ul class="nav navbar-nav suredy-form-bar">
				<li id="icon-save">
					<a href="#">
						<i class="icon-save"></i>
						保存
					</a>
				</li>
				<li id="icon-undo">
					<a href="#">
						<i class="icon-undo"></i>
						重置
					</a>
				</li>				
			</ul>
			<ul class="nav navbar-nav navbar-right">
				<li>
					<a href="#" class="suredy-close-form">
						<i class="icon-remove close" style="margin-right: 10px;"></i>
					</a>
				</li>
			</ul>
		</div>
		<div role="tabpanel" class="suredy-tabs">
			<!-- Tab panes -->
			<div class="tab-content">
				<div role="tabpanel" class="tab-pane active" id="tab1">
					<form method="post" id="form">
					 <#if data.id??><input type="hidden" name="id" value="${data.id}" /></#if>
						<div class="form-group">
							<div class="input-group">
								<div class="input-group-addon">配置名称</div>
								<input type="text" class="form-control required" name="name" placeholder="最多128个字符" value="${data.name}" />
							</div>
							<div class="input-group">
								<div class="input-group-addon">所属应用</div>
								<input type="text" class="form-control required" name="appId" placeholder="最多255个字符" value="${data.appId}" />
							</div>							
							<div class="input-group">
								<div class="input-group-addon">新建地址</div>
								<input type="text" class="form-control required" name="newURI" placeholder="最多255个字符"  />
							</div>	
							<div class="input-group">
								<div class="input-group-addon">打开地址</div>
								<input type="text" class="form-control required" name="openURI" placeholder="最多255个字符" value="${data.openURI}" />
							</div>															
							<div class="input-group">
								<div class="input-group-addon">流程ID&nbsp;&nbsp;&nbsp;</div>
								<input type="text" class="form-control required" name="flowUN" placeholder="最多255个字符" value="${data.flowUN}" />
							</div>								
							<div class="input-group">
								<div class="input-group-addon">文档模板</div>
								<select class="form-control" name="templateId">
									<#if docTemplates??><#list docTemplates as template>
									    <#if template.id == data.templateId >
										    <option value="${template.id}" selected="selected">${template.name}</option>
										<#else>
										    <option value="${template.id}">${template.name}</option>
										</#if>
									</#list> </#if>	
								</select>								
							</div>								
							<div class="input-group">
								<div class="input-group-addon">编号模式</div>
								<select class="form-control" name="snmodeId">
									<#if sNs??> <#list sNs as sn>
										<#if sn.id == data.snmodeId >
											<option value="${sn.id}" selected="selected">${sn.content}</option>
										<#else>
											<option value="${sn.id}">${sn.content}</option>
										</#if>	
									</#list> </#if>	
								</select>	
							</div>								
							<div class="input-group">
								<div class="input-group-addon">电子印章</div>
								<select class="form-control" name="esealId">
									<#if eSeals??> <#list eSeals as eSeal>
										<#if eSeal.id == data.esealId >
											<option value="${eSeal.id}" selected="selected">${eSeal.name}</option>
										<#else>
											<option value="${eSeal.id}">${eSeal.name}</option>
										</#if>	
									</#list> </#if>										
								</select>								
							</div>
							<div class="input-group">
								<div class="input-group-addon">配置描述</div>
								<textarea class="form-control" rows="5" name="description" placeholder="最多500个汉字">${data.description}</textarea>
							</div>															
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<script src="${request.contextPath}/core/js/jquery-1.11.1.min.js"></script>
	<script src="${request.contextPath}/core/js/jquery.validate.js"></script>
	<script src="${request.contextPath}/core/js/bootstrap.min.js"></script>
	<script src="${request.contextPath}/js/suredy.js"></script>
	<script src="${request.contextPath}/js/suredy-ui.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#icon-undo").click(function() {
				$('#form')[0].reset(); 
			});
			$("#icon-save").click(function() {
				if($("#form").valid()){
					$.ajax({
						type : "POST",//发送请求的方式
						url : "filetypeconfig-save.do",
						data : $('#form').serialize(),
						dataType : "json",//文件类型
						cache : false,
						timeout : 10000,//超时设置，单位为毫秒
						error : function(XMLHttpRequest, textStatus, errorThrown) {
							alert("未知错误,提交信息失败...");
						},
						success : function(result) {
							//todo
						}
					});
				}
			});			
		});
	</script>	
</body>
</html>
